package hoge.memoriesalbum.util;

import android.content.Context;
import android.content.SharedPreferences;

public class PreferencesUtil {
    private static final String TAG = "MemoriesAlbum";

    /**
     * プリファレンス情報取得
     */
    public static final int getPreferences(Context context, String key, int value) {
        SharedPreferences settings = context.getSharedPreferences(TAG, Context.MODE_PRIVATE);
        return settings.getInt(key, value);
    }

    /**
     * プリファレンス情報取得
     */
    public static final String getPreferences(Context context, String key, String value) {
        SharedPreferences settings = context.getSharedPreferences(TAG, Context.MODE_PRIVATE);
        return settings.getString(key, value);
    }

    /**
     * プリファレンス情報設定
     */
    public static final void setPreferences(Context context, String key, int value) {
        SharedPreferences settings = context.getSharedPreferences(TAG, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = settings.edit();
        editor.putInt(key, value);
        editor.commit();
    }

    /**
     * プリファレンス情報設定
     */
    public static final void setPreferences(Context context, String key, String value) {
        SharedPreferences settings = context.getSharedPreferences(TAG, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = settings.edit();
        editor.putString(key, value);
        editor.commit();
    }
}